<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>新建模型</title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
        <link rel="stylesheet" type="text/css" href="__PUBLIC__/Admin/style/layout.css"/> 
        <link rel="stylesheet" type="text/css" href="__PUBLIC__/Admin/style/content.css"/>
        <script>
            function moveup(obj){
                var parent=$(obj).parent().parent();//寻找到父级tr节点
                var prevparent=parent.prev().has('td');
                $(parent).insertBefore($(prevparent)).hide().show('slow');

            }
            function movedown(obj){
                var parent=$(obj).parent().parent();//寻找到父级tr节点
                var prevparent=parent.next().has('td');
                $(parent).insertAfter($(prevparent)).hide().show('slow');
            }
            function editfield(fieldname){
                window.location.href="<{:U('editfield',array('fieldname'=>'"+fieldname+"','id'=>$channel['id']))}>";
            }
        </script>
        <!--[if lt IE 8]>
        <script>alert('你正在使用IE，版本低于8.0，页面样式和部分JS效果可能异常，强烈建议使用谷歌浏览器或IE10以上');</script>
        <![endif]-->
    </head>
    <body>
        <div class="cbox col9 f_l">
        <form action='<{:U('edit')}>' method="POST">
            <input type='hidden' name='id' value='<{$channel.id}>'/>
            <div class="header"><h3>模型编辑</h3></div>
            <div class="content">
                <div class="innerbox">
                    <fieldset class="col9">
                        <label>模型ID：<{$channel.id}>  扩展表：<{$channel.addtable}></label>
                    </fieldset>
                    <fieldset class="col9">
                        <label>扩展字段</label>
                        <div style="margin:12px;">
                            <table class="tt" >
                                <tr>
                                    <th width="30px;">序号</th>
                                    <th>表单</th>
                                    <th>字段名</th>
                                    <th>类型</th>
                                    <th width="250px">操作</th>
                                </tr>
                                
                                <volist name="channel['fieldset']" id='eachfield'>
                                
                                <tr>
                                    <td><{$i}><input type='hidden' name='fieldset[]' value='<{$eachfield|serialize}>' style="display:none;"/></td>
                                    <td><{$eachfield.itemname}></td>
                                    <td><{$eachfield.fieldname}></td>
                                    <td><{$eachfield.itemtype}></td>
                                    <td><input type='button' onclick='moveup(this)' value='上移'/> <input type='button' onclick='movedown(this)' value='下移'/> <input type='button' onclick="editfield('<{$eachfield.fieldname}>')" value='编辑'/> <input type='button' onclick='$(this).parent().parent().remove()' value='移除'/></td>
                                </tr>
                                
                                </volist>
                            </table>
                        </div>
                        <p><a href="<{:U('addfield?id='.$channel['id'])}>">增加字段</a></p>
                    </fieldset>
                </div>
            </div>
            <div class="footer">
                <div class="submit f_r">
                    <input type="submit" value="Submit" class="subbtn"/>
                    <input type="reset" value="Reset"/>
                </div>
            </div>
        </form>
        </div>
        
    </body>
</html>
